Optimal. Leaf size=171 \[ \frac {8 \sqrt [4]{-1} a^3 (i A+B) \text {ArcTan}\left ((-1)^{3/4} \sqrt {\tan (c+d x)}\right )}{d}+\frac {8 a^3 (i A+B) \sqrt {\tan (c+d x)}}{d}-\frac {8 a^3 (21 A-23 i B) \tan ^{\frac {3}{2}}(c+d x)}{105 d}+\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d}-\frac {2 (7 A-11 i B) \tan ^{\frac {3}{2}}(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{35 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.29, antiderivative size = 171, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.139, Rules used = {3675, 3673,
3609, 3614, 211} \begin {gather*} \frac {8 \sqrt [4]{-1} a^3 (B+i A) \text {ArcTan}\left ((-1)^{3/4} \sqrt {\tan (c+d x)}\right )}{d}-\frac {8 a^3 (21 A-23 i B) \tan ^{\frac {3}{2}}(c+d x)}{105 d}-\frac {2 (7 A-11 i B) \tan ^{\frac {3}{2}}(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{35 d}+\frac {8 a^3 (B+i A) \sqrt {\tan (c+d x)}}{d}+\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 3609
Rule 3614
Rule 3673
Rule 3675
Rubi steps
\begin {align*} \int \sqrt {\tan (c+d x)} (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx &=\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d}+\frac {2}{7} \int \sqrt {\tan (c+d x)} (a+i a \tan (c+d x))^2 \left (\frac {1}{2} a (7 A-3 i B)+\frac {1}{2} a (7 i A+11 B) \tan (c+d x)\right ) \, dx\\ &=\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d}-\frac {2 (7 A-11 i B) \tan ^{\frac {3}{2}}(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{35 d}+\frac {4}{35} \int \sqrt {\tan (c+d x)} (a+i a \tan (c+d x)) \left (2 a^2 (7 A-6 i B)+a^2 (21 i A+23 B) \tan (c+d x)\right ) \, dx\\ &=-\frac {8 a^3 (21 A-23 i B) \tan ^{\frac {3}{2}}(c+d x)}{105 d}+\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d}-\frac {2 (7 A-11 i B) \tan ^{\frac {3}{2}}(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{35 d}+\frac {4}{35} \int \sqrt {\tan (c+d x)} \left (35 a^3 (A-i B)+35 a^3 (i A+B) \tan (c+d x)\right ) \, dx\\ &=\frac {8 a^3 (i A+B) \sqrt {\tan (c+d x)}}{d}-\frac {8 a^3 (21 A-23 i B) \tan ^{\frac {3}{2}}(c+d x)}{105 d}+\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d}-\frac {2 (7 A-11 i B) \tan ^{\frac {3}{2}}(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{35 d}+\frac {4}{35} \int \frac {-35 a^3 (i A+B)+35 a^3 (A-i B) \tan (c+d x)}{\sqrt {\tan (c+d x)}} \, dx\\ &=\frac {8 a^3 (i A+B) \sqrt {\tan (c+d x)}}{d}-\frac {8 a^3 (21 A-23 i B) \tan ^{\frac {3}{2}}(c+d x)}{105 d}+\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d}-\frac {2 (7 A-11 i B) \tan ^{\frac {3}{2}}(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{35 d}+\frac {\left (280 a^6 (i A+B)^2\right ) \text {Subst}\left (\int \frac {1}{-35 a^3 (i A+B)-35 a^3 (A-i B) x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{d}\\ &=\frac {8 \sqrt [4]{-1} a^3 (i A+B) \tan ^{-1}\left ((-1)^{3/4} \sqrt {\tan (c+d x)}\right )}{d}+\frac {8 a^3 (i A+B) \sqrt {\tan (c+d x)}}{d}-\frac {8 a^3 (21 A-23 i B) \tan ^{\frac {3}{2}}(c+d x)}{105 d}+\frac {2 i a B \tan ^{\frac {3}{2}}(c+d x) (a+i a \tan (c+d x))^2}{7 d}-\frac {2 (7 A-11 i B) \tan ^{\frac {3}{2}}(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{35 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(452\) vs. \(2(171)=342\).
time = 8.13, size = 452, normalized size = 2.64 \begin {gather*} -\frac {8 i (A-i B) e^{-3 i c} \sqrt {-\frac {i \left (-1+e^{2 i (c+d x)}\right )}{1+e^{2 i (c+d x)}}} \tanh ^{-1}\left (\sqrt {\frac {-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}}\right ) \cos ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x))}{d \sqrt {\frac {-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}} (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))}+\frac {\cos ^4(c+d x) \left (\sec (c) \sec ^2(c+d x) (7 A \cos (c)-21 i B \cos (c)+5 B \sin (c)) \left (-\frac {2}{35} i \cos (3 c)-\frac {2}{35} \sin (3 c)\right )+\sec (c) (441 i A \cos (c)+483 B \cos (c)-105 A \sin (c)+155 i B \sin (c)) \left (\frac {2}{105} \cos (3 c)-\frac {2}{105} i \sin (3 c)\right )-i B \sec (c) \sec ^3(c+d x) \left (\frac {2}{7} \cos (3 c)-\frac {2}{7} i \sin (3 c)\right ) \sin (d x)+\sec (c) \sec (c+d x) \left (-\frac {2}{21} \cos (3 c)+\frac {2}{21} i \sin (3 c)\right ) (21 A \sin (d x)-31 i B \sin (d x))\right ) \sqrt {\tan (c+d x)} (a+i a \tan (c+d x))^3 (A+B \tan (c+d x))}{d (\cos (d x)+i \sin (d x))^3 (A \cos (c+d x)+B \sin (c+d x))} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 276, normalized size = 1.61
method | result | size |
derivativedivides | \(\frac {a^{3} \left (-\frac {2 i B \left (\tan ^{\frac {7}{2}}\left (d x +c \right )\right )}{7}-\frac {2 i A \left (\tan ^{\frac {5}{2}}\left (d x +c \right )\right )}{5}-\frac {6 B \left (\tan ^{\frac {5}{2}}\left (d x +c \right )\right )}{5}+\frac {8 i B \left (\tan ^{\frac {3}{2}}\left (d x +c \right )\right )}{3}-2 A \left (\tan ^{\frac {3}{2}}\left (d x +c \right )\right )+8 i A \left (\sqrt {\tan }\left (d x +c \right )\right )+8 B \left (\sqrt {\tan }\left (d x +c \right )\right )+\frac {\left (-4 i A -4 B \right ) \sqrt {2}\, \left (\ln \left (\frac {1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}+\frac {\left (-4 i B +4 A \right ) \sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}\right )}{d}\) | \(276\) |
default | \(\frac {a^{3} \left (-\frac {2 i B \left (\tan ^{\frac {7}{2}}\left (d x +c \right )\right )}{7}-\frac {2 i A \left (\tan ^{\frac {5}{2}}\left (d x +c \right )\right )}{5}-\frac {6 B \left (\tan ^{\frac {5}{2}}\left (d x +c \right )\right )}{5}+\frac {8 i B \left (\tan ^{\frac {3}{2}}\left (d x +c \right )\right )}{3}-2 A \left (\tan ^{\frac {3}{2}}\left (d x +c \right )\right )+8 i A \left (\sqrt {\tan }\left (d x +c \right )\right )+8 B \left (\sqrt {\tan }\left (d x +c \right )\right )+\frac {\left (-4 i A -4 B \right ) \sqrt {2}\, \left (\ln \left (\frac {1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}+\frac {\left (-4 i B +4 A \right ) \sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}\right )}{d}\) | \(276\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 216, normalized size = 1.26 \begin {gather*} -\frac {30 i \, B a^{3} \tan \left (d x + c\right )^{\frac {7}{2}} + 42 \, {\left (i \, A + 3 \, B\right )} a^{3} \tan \left (d x + c\right )^{\frac {5}{2}} + 70 \, {\left (3 \, A - 4 i \, B\right )} a^{3} \tan \left (d x + c\right )^{\frac {3}{2}} + 840 \, {\left (-i \, A - B\right )} a^{3} \sqrt {\tan \left (d x + c\right )} + 105 \, {\left (2 \, \sqrt {2} {\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + 2 \, \sqrt {\tan \left (d x + c\right )}\right )}\right ) + 2 \, \sqrt {2} {\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - 2 \, \sqrt {\tan \left (d x + c\right )}\right )}\right ) - \sqrt {2} {\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \log \left (\sqrt {2} \sqrt {\tan \left (d x + c\right )} + \tan \left (d x + c\right ) + 1\right ) + \sqrt {2} {\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \log \left (-\sqrt {2} \sqrt {\tan \left (d x + c\right )} + \tan \left (d x + c\right ) + 1\right )\right )} a^{3}}{105 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 498 vs. \(2 (137) = 274\).
time = 3.29, size = 498, normalized size = 2.91 \begin {gather*} -\frac {2 \, {\left (105 \, \sqrt {-\frac {{\left (-i \, A^{2} - 2 \, A B + i \, B^{2}\right )} a^{6}}{d^{2}}} {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac {2 \, {\left ({\left (A - i \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + \sqrt {-\frac {{\left (-i \, A^{2} - 2 \, A B + i \, B^{2}\right )} a^{6}}{d^{2}}} {\left (d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (-i \, A - B\right )} a^{3}}\right ) - 105 \, \sqrt {-\frac {{\left (-i \, A^{2} - 2 \, A B + i \, B^{2}\right )} a^{6}}{d^{2}}} {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac {2 \, {\left ({\left (A - i \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} - \sqrt {-\frac {{\left (-i \, A^{2} - 2 \, A B + i \, B^{2}\right )} a^{6}}{d^{2}}} {\left (d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (-i \, A - B\right )} a^{3}}\right ) + 2 \, {\left ({\left (-273 i \, A - 319 \, B\right )} a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 2 \, {\left (-336 i \, A - 323 \, B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-567 i \, A - 551 \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 4 \, {\left (-42 i \, A - 41 \, B\right )} a^{3}\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )}}{105 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - i a^{3} \left (\int \left (- 3 A \tan ^{\frac {3}{2}}{\left (c + d x \right )}\right )\, dx + \int A \tan ^{\frac {7}{2}}{\left (c + d x \right )}\, dx + \int \left (- 3 B \tan ^{\frac {5}{2}}{\left (c + d x \right )}\right )\, dx + \int B \tan ^{\frac {9}{2}}{\left (c + d x \right )}\, dx + \int i A \sqrt {\tan {\left (c + d x \right )}}\, dx + \int \left (- 3 i A \tan ^{\frac {5}{2}}{\left (c + d x \right )}\right )\, dx + \int i B \tan ^{\frac {3}{2}}{\left (c + d x \right )}\, dx + \int \left (- 3 i B \tan ^{\frac {7}{2}}{\left (c + d x \right )}\right )\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.00, size = 160, normalized size = 0.94 \begin {gather*} -\frac {\left (4 i - 4\right ) \, \sqrt {2} {\left (A a^{3} - i \, B a^{3}\right )} \arctan \left (-\left (\frac {1}{2} i - \frac {1}{2}\right ) \, \sqrt {2} \sqrt {\tan \left (d x + c\right )}\right )}{d} - \frac {2 \, {\left (15 i \, B a^{3} d^{6} \tan \left (d x + c\right )^{\frac {7}{2}} + 21 i \, A a^{3} d^{6} \tan \left (d x + c\right )^{\frac {5}{2}} + 63 \, B a^{3} d^{6} \tan \left (d x + c\right )^{\frac {5}{2}} + 105 \, A a^{3} d^{6} \tan \left (d x + c\right )^{\frac {3}{2}} - 140 i \, B a^{3} d^{6} \tan \left (d x + c\right )^{\frac {3}{2}} - 420 i \, A a^{3} d^{6} \sqrt {\tan \left (d x + c\right )} - 420 \, B a^{3} d^{6} \sqrt {\tan \left (d x + c\right )}\right )}}{105 \, d^{7}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.92, size = 292, normalized size = 1.71 \begin {gather*} \frac {A\,a^3\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,8{}\mathrm {i}}{d}-\frac {2\,A\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^{3/2}}{d}-\frac {A\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^{5/2}\,2{}\mathrm {i}}{5\,d}+\frac {8\,B\,a^3\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}}{d}+\frac {B\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^{3/2}\,8{}\mathrm {i}}{3\,d}-\frac {6\,B\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^{5/2}}{5\,d}-\frac {B\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^{7/2}\,2{}\mathrm {i}}{7\,d}+\frac {\sqrt {2}\,A\,a^3\,\ln \left (8\,A\,a^3\,d+\sqrt {2}\,A\,a^3\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,\left (-4-4{}\mathrm {i}\right )\right )\,\left (2+2{}\mathrm {i}\right )}{d}-\frac {\sqrt {16{}\mathrm {i}}\,A\,a^3\,\ln \left (8\,A\,a^3\,d+2\,\sqrt {16{}\mathrm {i}}\,A\,a^3\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )}{d}+\frac {\sqrt {2}\,B\,a^3\,\ln \left (-B\,a^3\,d\,8{}\mathrm {i}+\sqrt {2}\,B\,a^3\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,\left (-4+4{}\mathrm {i}\right )\right )\,\left (2-2{}\mathrm {i}\right )}{d}-\frac {\sqrt {-16{}\mathrm {i}}\,B\,a^3\,\ln \left (-B\,a^3\,d\,8{}\mathrm {i}+2\,\sqrt {-16{}\mathrm {i}}\,B\,a^3\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________